package com.springboot.mongodb.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.mongodb.service.AccounService;

@RestController
@RequestMapping("/mongodb")
public class MongodbController {
	private AccounService accountService;
	
	@Autowired
	public void setAccountService(AccounService accountService) {
		this.accountService = accountService;
	}
	
	@RequestMapping(value = "/set", method = RequestMethod.GET)
    public void setMongodb() {
		accountService.setMongodbData();
    }
	
	@RequestMapping(value = "/get-by-id", method = RequestMethod.GET)
    public void getMongodbById() {
		accountService.getMongodbById("1");
    }
	
	@RequestMapping(value = "/find-by-name", method = RequestMethod.GET)
    public void findMongodbByName() {
		accountService.findMongodbByName("kangkang");
    }

}
